<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <%@ include file="/WEB-INF/views/include/head.jsp"%>
    <link rel="stylesheet" href="${ctxStatic}/css/list.css">
    <title><spring:message code="bigcargo_style_list" /></title>
    <script src="${ctxStatic}/js/jquery-1.9.1.min.js"></script>
    <script src="${ctxStatic}/js/style.js"></script>
    <script>
        $(document).ready(function() {
            $("#operatingId").select2();
            $("#chekcData").click(function () {
            	$("#activity_pane").showLoading();
                var params = $("#searchForm").serialize();
                $.post("${ctx}/check/project/saveForm",params,function(result) {
                	$("#activity_pane").hideLoading();
                    
                }, 'json').success(function(result) {
                	if (confirm(result.message+"\n是否前往设置工序项目布局？")) {
		            	setSortImage(); 
					}
                }).error(function(result) {
                	tipParent(result.message);
                });
            });
        });

        // 全选的情况下 hidden项目打开
        function checkAllbox(obj,tableid) {
            var checkTemp = obj.checked;
            if (checkTemp) {
                $("#"+tableid).find("input:checkbox").each(function () {
                    this.checked=true;
                });
                $("#"+tableid).find("input:hidden").each(function () {
                    this.disabled="";
                });
            } else {
                $("#"+tableid).find("input:checkbox").each(function () {
                    this.checked=false;
                });
                $("#"+tableid).find("input:hidden").each(function () {
                    $(this).attr("disabled","disabled");
                });
            }
        }
        // 单选的情况下 hidden项目打开
        function changeDisabled(obj) {
            var checkTemp = obj.checked;
            var tdObj = $(obj).parent();
            if (checkTemp) {
                $(tdObj).find("input:hidden")[0].disabled="";
            } else {
                $(tdObj).find("input:hidden").attr("disabled","disabled");
            }
        }
        function changeOreratingId(obj) {
            var orgaringID = $(obj).val();
            $.post("${ctx}/check/project/changeForm?operatingId="+orgaringID,"",function(result) {
                var changeHtml = result["allCheckBoxHtml"];
                $("#changeHtml").html(changeHtml);
            }, 'json');
        }
        
        /**
         * 跳转设置工序布局画面 
         */
        function setSortImage() {
        	
        	popup('900px','584px','${ctx}/check/project/setSortImage?operatingId='+$("#operatingId").val()+'&operatingName='+$("#operatingId").find("option:selected").text());
		}
    </script>
</head>
<body>
    <div class="listArea" id="activity_pane">
        <form id="searchForm" method="post" >
        <div class="listBg" style="height: 800px;">
            <div class="items clearfix">
                <div class="col-50 clearfix">
                    <strong style="font-size:15px;"><spring:message code="order_procedure"/></strong>
                </div>
            </div>
            <div class="searchArea clearfix" style="border:2px solid #13031e33;width:1458px;position:relative;left:10px;top:10px;height:50px">
                <div class="items clearfix">

                    <div class="col-50 clearfix haveToBox">
                        <!-- 工序列表 -->
                        <p class="tit" style="width:100px;">
                            <spring:message code="project_procedure"/>
                        </p>
                        <select style="width:230px" name="operatingId" id="operatingId" onchange="changeOreratingId(this)">
                            <c:forEach items="${itemObj.operatingList}" var="operatingList" varStatus="status">
                            <option value="${operatingList.operatingId}">${operatingList.valueNameCn}</option>
                            </c:forEach>
                        </select>
                    </div>
                    <div class="col-50 clearfix haveToBox" >
                    	<button style="position:absolute;right:60px" type="button" onclick="setSortImage();">设置工序布局</button>
                        <button style="position:absolute;right:1px" id="chekcData" type="button"><spring:message code="common_save"/></button>
                    </div>
                </div>
            </div>
            <div>
<div id="changeHtml">
                <div class="tableCheck" style="border:1px solid #13031e33;width:233px;height:670px;position:relative;left:10px;top:30px;;float: left;">
                    <div>
                        <div class="col-50" style="font-size: 17px"><strong ><spring:message code="style_project"/></strong></div>
                        <div class="col-50" ><input style="position:absolute;right:30px;top:5px" type="checkbox" onclick="checkAllbox(this,'oneTable')" />
                            <label style="position:absolute;right:50px;top:4px"><spring:message code="all_change"/></label></div>
                    </div>
                    <table cellpadding="0" class="tableHead" style="position:absolute;top:30px">
                        <thead>
                        <th><p style="width:130px">
                            <spring:message code="check_project"/>
                        </p></th>
                        <th><p style="width:70px">
                            <spring:message code="check_change"/>
                        </p></th>
                        </thead>
                    </table>
                    <div class="tableCheck" style="width:231px;height:595px;position:relative;top:45px;;float: left;overflow: auto;">
                        <table cellpadding="0" class="tableBody" id="oneTable">
                            <tbody>
                            <c:forEach items="${itemObj.typeCdListOne}" var="listOne" varStatus="status">
                                <tr>
                                    <!-- No. -->
                                    <td style="width:130px">
                                            ${listOne.valueNameCn}
                                    </td>
                                    <!-- 款式设计项目 -->
                                    <td style="width:70px">
                                <c:set value="" var="flg" />
                                <c:forEach items="${itemObj.operatingREntityList}" var="operRList">
                                        <c:if test="${listOne.designopionId eq operRList.designopionId}">
                                        <input type="checkbox" style="width: 70px;" checked = "checked" onclick="changeDisabled(this)">
                                            <c:set value="1" var="flg" />
                                        </c:if>
                                    </c:forEach>
                                        <c:choose>
                                            <c:when test="${flg == ''}">
                                            <input type="checkbox" style="width: 70px;" onclick="changeDisabled(this)">
                                             <input type="hidden" name="typeCdListOne[${status.index}].designopionId" value="${listOne.designopionId}" disabled="disabled">
                                            </c:when>
                                            <c:otherwise>
                                                <input type="hidden" name="typeCdListOne[${status.index}].designopionId" value="${listOne.designopionId}">
                                            </c:otherwise>
                                        </c:choose>
                                    </td>
                                </tr>
                            </c:forEach>
                            </tbody>
                        </table>
                    </div>
                </div>
                <div class="tableCheck" style="border:1px solid #13031e33;width:233px;height:670px;position:relative;left:20px;top:30px;;float: left;">
                    <div>
                        <div class="col-50" style="font-size: 17px"><strong ><spring:message code="check_material"/></strong></div>
                        <div class="col-50" ><input style="position:absolute;right:30px;top:5px" type="checkbox" onclick="checkAllbox(this,'twoTable')" />
                            <label style="position:absolute;right:50px;top:4px"><spring:message code="all_change"/></label></div>
                    </div>
                    <table cellpadding="0" class="tableHead" style="position:absolute;top:30px">
                        <thead>
                        
                        <th><p style="width:130px">
                            <spring:message code="check_project"/>
                        </p></th>
                        
                        <th><p style="width:70px">
                            <spring:message code="check_change"/>
                        </p></th>
                        </thead>
                    </table>
                    <div class="tableCheck" style="width:231px;height:592px;position:relative;top:45px;;float: left;overflow: auto;">
                        <table cellpadding="0" class="tableBody" id="twoTable">
                            <tbody>
                            <c:forEach items="${itemObj.typeCdListTwo}" var="listTwo" varStatus="status">
                                <tr>
                                    
                                    <td style="width:130px">
                                            ${listTwo.valueNameCn}
                                    </td>
                                    <!-- 辅料 -->
                                    <td style="width:70px">
                                        <c:set value="" var="flg" />
                                        <c:forEach items="${itemObj.operatingREntityList}" var="operRList">
                                            <c:if test="${listTwo.designopionId eq operRList.designopionId}">
                                                <input type="checkbox" style="width: 70px;" checked = "checked" onclick="changeDisabled(this)">
                                                <c:set value="1" var="flg" />
                                            </c:if>
                                        </c:forEach>
                                        <c:choose>
                                            <c:when test="${flg == ''}">
                                                <input type="checkbox" style="width: 70px;" onclick="changeDisabled(this)">
                                                <input type="hidden" name="typeCdListTwo[${status.index}].designopionId" value="${listTwo.designopionId}" disabled="disabled">
                                            </c:when>
                                            <c:otherwise>
                                                <input type="hidden" name="typeCdListTwo[${status.index}].designopionId" value="${listTwo.designopionId}">
                                            </c:otherwise>
                                        </c:choose>
                                    </td>
                                </tr>
                            </c:forEach>
                            </tbody>
                        </table>
                    </div>
                </div>

                <div class="tableCheck" style="border:1px solid #13031e33;width:233px;height:670px;position:relative;left:40px;top:30px;;float: left;">
                    <div>
                        <div class="col-50" style="font-size: 17px"><strong ><spring:message code="label_address"/></strong></div>
                        <div class="col-50" ><input style="position:absolute;right:30px;top:5px" type="checkbox" onclick="checkAllbox(this,'fourTable')" />
                            <label style="position:absolute;right:50px;top:4px"><spring:message code="all_change"/></label></div>
                    </div>
                    <table cellpadding="0" class="tableHead" style="position:absolute;top:30px">
                        <thead>
                        <!-- No. -->
                        <th><p style="width:130px">
    <spring:message code="check_project"/>
                        </p></th>
                        <th><p style="width:70px">
    <spring:message code="check_change"/>
                        </p></th>
                        </thead>
                    </table>
                    <div class="tableCheck" style="width:231px;height:592px;position:relative;top:45px;;float: left;overflow: auto;">
                        <table cellpadding="0" class="tableBody" id="fourTable">
                            <tbody>
                            <c:forEach items="${itemObj.typeCdListFour}" var="listFour" varStatus="status">
                                <tr>
                                    <!-- No. -->
                                    <td style="width:130px">
                                            ${listFour.valueNameCn}
                                    </td>
                                    <!-- 标牌 -->
                                    <td style="width:70px">
                                        <c:set value="" var="flg" />
                                        <c:forEach items="${itemObj.operatingREntityList}" var="operRList">
                                            <c:if test="${listFour.designopionId eq operRList.designopionId}">
                                                <input type="checkbox" style="width: 70px;" checked = "checked" onclick="changeDisabled(this)">
                                                <c:set value="1" var="flg" />
                                            </c:if>
                                        </c:forEach>
                                        <c:choose>
                                            <c:when test="${flg == ''}">
                                                <input type="checkbox" style="width: 70px;" onclick="changeDisabled(this)">
                                                <input type="hidden" name="typeCdListFour[${status.index}].designopionId" value="${listFour.designopionId}" disabled="disabled">
                                            </c:when>
                                            <c:otherwise>
                                                <input type="hidden" name="typeCdListFour[${status.index}].designopionId" value="${listFour.designopionId}">
                                            </c:otherwise>
                                        </c:choose>
                                    </td>
                                </tr>
                            </c:forEach>
                            </tbody>
                        </table>
                    </div>
                </div>
                <div class="tableCheck" style="border:1px solid #13031e33;width:233px;height:670px;position:relative;left:50px;top:30px;;float: left;">
                    <div>
                        <div class="col-50" style="font-size: 17px"><strong ><spring:message code="embroidery_address"/></strong></div>
                        <div class="col-50" ><input style="position:absolute;right:30px;top:5px" type="checkbox" onclick="checkAllbox(this,'fiveTable')" />
                            <label style="position:absolute;right:50px;top:4px"><spring:message code="all_change"/></label></div>
                    </div>
                    <table cellpadding="0" class="tableHead" style="position:absolute;top:30px">
                        <thead>
                        <!-- No. -->
                        <th><p style="width:130px">
    <spring:message code="check_project"/>
                        </p></th>
                        <!-- 质检项目图片 -->
                        <th><p style="width:70px">
    <spring:message code="check_change"/>
                        </p></th>
                        </thead>
                    </table>
                    <div class="tableCheck" style="width:231px;height:592px;position:relative;top:45px;;float: left;overflow: auto;">
                        <table cellpadding="0" class="tableBody" id="fiveTable">
                            <tbody>
                            <c:forEach items="${itemObj.typeCdListFive}" var="listFive" varStatus="status">
                                <tr>
                                    <!-- No. -->
                                    <td style="width:130px">
                                            ${listFive.valueNameCn}
                                    </td>
                                    <!-- 刺绣 -->
                                    <td style="width:70px">
                                        <c:set value="" var="flg" />
                                        <c:forEach items="${itemObj.operatingREntityList}" var="operRList">
                                            <c:if test="${listFive.designopionId eq operRList.designopionId}">
                                                <input type="checkbox" style="width: 70px;" checked = "checked" onclick="changeDisabled(this)">
                                                <c:set value="1" var="flg" />
                                            </c:if>
                                        </c:forEach>
                                        <c:choose>
                                            <c:when test="${flg == ''}">
                                                <input type="checkbox" style="width: 70px;" onclick="changeDisabled(this)">
                                                <input type="hidden" name="typeCdListFive[${status.index}].designopionId" value="${listFive.designopionId}" disabled="disabled">
                                            </c:when>
                                            <c:otherwise>
                                                <input type="hidden" name="typeCdListFive[${status.index}].designopionId" value="${listFive.designopionId}">
                                            </c:otherwise>
                                        </c:choose>
                                    </td>
                                </tr>
                            </c:forEach>
                            </tbody>
                        </table>
                    </div>
                </div>
                <div class="tableCheck" style="border:1px solid #13031e33;width:233px;height:670px;position:relative;left:60px;top:30px;;float: left;">
                    <div>
                        <div class="col-50" style="font-size: 17px"><strong ><spring:message code="batching_project"/></strong></div>
                        <div class="col-50" ><input style="position:absolute;right:30px;top:5px" type="checkbox" onclick="checkAllbox(this,'sixTable')" />
                            <label style="position:absolute;right:50px;top:4px"><spring:message code="all_change"/></label></div>
                    </div>
                    <table cellpadding="0" class="tableHead" style="position:absolute;top:30px">
                        <thead>
                        <!-- No. -->
                        <th><p style="width:130px">
    <spring:message code="check_project"/>
                        </p></th>
                        <!-- 质检项目图片 -->
                        <th><p style="width:70px">
    <spring:message code="check_change"/>
                        </p></th>
                        </thead>
                    </table>
                    <div class="tableCheck" style="width:231px;height:592px;position:relative;top:45px;;float: left;overflow: auto;">
                        <table cellpadding="0" class="tableBody" id="sixTable">
                            <tbody>
                            <c:forEach items="${itemObj.typeCdListSix}" var="listSix" varStatus="status">
                                <tr>
                                    <!-- No. -->
                                    <td style="width:130px">
                                            ${listSix.valueNameCn}
                                    </td>
                                    <!-- 配料 -->
                                    <td style="width:70px">
                                        <c:set value="" var="flg" />
                                        <c:forEach items="${itemObj.operatingREntityList}" var="operRList">
                                            <c:if test="${listSix.designopionId eq operRList.designopionId}">
                                                <input type="checkbox" style="width: 70px;" checked = "checked" onclick="changeDisabled(this)">
                                                <c:set value="1" var="flg" />
                                            </c:if>
                                        </c:forEach>
                                        <c:choose>
                                            <c:when test="${flg == ''}">
                                                <input type="checkbox" style="width: 70px;" onclick="changeDisabled(this)">
                                                <input type="hidden" name="typeCdListSix[${status.index}].designopionId" value="${listSix.designopionId}" disabled="disabled">
                                            </c:when>
                                            <c:otherwise>
                                                <input type="hidden" name="typeCdListSix[${status.index}].designopionId" value="${listSix.designopionId}">
                                            </c:otherwise>
                                        </c:choose>
                                    </td>
                                </tr>
                            </c:forEach>
                            </tbody>
                        </table>
                    </div>
                </div>
                <div class="tableCheck" style="border:1px solid #13031e33;width:233px;height:670px;position:relative;left:70px;top:30px;;float: left;">
                    <div>
                        <div class="col-50" style="font-size: 17px"><strong ><spring:message code="fit_project"/></strong></div>
                        <div class="col-50" ><input style="position:absolute;right:30px;top:5px" type="checkbox" onclick="checkAllbox(this,'sevenTable')" />
                            <label style="position:absolute;right:50px;top:4px"><spring:message code="all_change"/></label></div>
                    </div>
                    <table cellpadding="0" class="tableHead" style="position:absolute;top:30px">
                        <thead>
                        <!-- No. -->
                        <th><p style="width:130px">
    <spring:message code="check_project"/>
                        </p></th>
                        <!-- 质检项目图片 -->
                        <th><p style="width:70px">
    <spring:message code="check_change"/>
                        </p></th>
                        </thead>
                    </table>
                    <div class="tableCheck" style="width:231px;height:592px;position:relative;top:45px;;float: left;overflow: auto;">
                        <table cellpadding="0" class="tableBody" id="sevenTable">
                            <tbody>
                            <c:forEach items="${itemObj.typeCdListSeven}" var="listSeven" varStatus="status">
                                <tr>
                                    <!-- No. -->
                                    <td style="width:130px">
                                            ${listSeven.valueNameCn}
                                    </td>
                                    <!-- 量体 -->
                                    <td style="width:70px">
                                        <c:set value="" var="flg" />
                                        <c:forEach items="${itemObj.operatingFitREntityList}" var="operFitRList">
                                            <c:if test="${listSeven.fitPropertyId eq operFitRList.fitPropertyId}">
                                                <input type="checkbox" style="width: 70px;" checked = "checked" onclick="changeDisabled(this)">
                                                <c:set value="1" var="flg" />
                                            </c:if>
                                        </c:forEach>
                                        <c:choose>
                                            <c:when test="${flg == ''}">
                                                <input type="checkbox" style="width: 70px;" onclick="changeDisabled(this)">
                                                <input type="hidden" name="typeCdListSeven[${status.index}].fitPropertyId" value="${listSeven.fitPropertyId}" disabled="disabled">
                                            </c:when>
                                            <c:otherwise>
                                                <input type="hidden" name="typeCdListSeven[${status.index}].fitPropertyId" value="${listSeven.fitPropertyId}">
                                            </c:otherwise>
                                        </c:choose>
                                    </td>
                                </tr>
                            </c:forEach>
                            </tbody>
                        </table>
                    </div>
                </div>
</div>
            </div>
            </form>
        </div>
</body>
</html>
